package com.code.base.dic.service;

import java.util.List;
import java.util.Date;
import java.util.Map;
import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.code.base.dic.persistence.DicDepartmentMapper;
import com.code.base.dic.pojo.DicDepartment;
import com.code.util.PrimaryKeyUtil;


@Service
public class DicDepartmentService {


	@Resource
	private DicDepartmentMapper dicDepartmentMapper;

	public Long getInsertId() {
		return PrimaryKeyUtil.generatePrimaryKey();
	}

	public DicDepartment getDataById(Long id) {
		return dicDepartmentMapper.getDataById(id);
	}

	public List<DicDepartment> getAllData() {
		return dicDepartmentMapper.getAllData();
	}

	public int getDataCountByCondition(DicDepartment entity) {
		return dicDepartmentMapper.getDataCountByCondition(entity);
	}

	public List<DicDepartment> getDataByCondition(DicDepartment entity) {
		return dicDepartmentMapper.getDataByCondition(entity);
	}

	public int getDataCountByLikeCondition(DicDepartment entity) {
		return dicDepartmentMapper.getDataCountByLikeCondition(entity);
	}

	public List<DicDepartment> getDataByLikeCondition(DicDepartment entity) {
		return dicDepartmentMapper.getDataByLikeCondition(entity);
	}

	public List<DicDepartment> getDataByIds(Long[] ids) {
		return dicDepartmentMapper.getDataByIds(ids);
	}

	public void insertData(DicDepartment entity) {
		insertData(entity, true);
	}

	public void insertData(DicDepartment entity, boolean setIdValue) {
		if (setIdValue) {
			entity.setId(getInsertId());
		}
		dicDepartmentMapper.insertData(entity);
	}

	public void updateData(DicDepartment entity) {
		dicDepartmentMapper.updateData(entity);
	}

	public void updateDataByParam(Map<String, Object> map) {
		if (map.size() == 0)
			return;

		dicDepartmentMapper.updateDataByParam(map);
	}

	public void deleteDataByObject(DicDepartment entity) {
		dicDepartmentMapper.deleteDataByObject(entity);
	}

	public void deleteDataById(Long id) {
		dicDepartmentMapper.deleteDataById(id);
	}

	public void deleteDataByIds(Long[] ids) {
		dicDepartmentMapper.deleteDataByIds(ids);
	}

}
